import cv2
import numpy as np
image = cv2.imread('img_1.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
_,binary = cv2.threshold(gray,200,255, cv2.THRESH_BINARY)
# 根据二值化图像框选图像轮廓
contours, _ = cv2.findContours(binary, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
result = image.copy()
# 再根据contours的内容draw出来即可有下图：
for cnt in contours:
    area = cv2.contourArea(cnt)
    if 600 < cv2.contourArea(cnt) < 2500:
        epsilon = 0.02 * cv2.arcLength(cnt, True)
        approx = cv2.approxPolyDP(cnt, epsilon, True)
        if len(approx) ==6:
            min_rect = cv2.minAreaRect(cnt)
            box = cv2.boxPoints(min_rect)
            box = np.int32(box)
            cv2.drawContours(result, [box], 0, (0, 255, 0), 2)

cv2.imshow('detected arrows', result)
cv2.waitKey(0)
cv2.destroyWindow()